import Toast from 'react-native-root-toast';
import AsyncStorage from '@react-native-async-storage/async-storage';

export default {
  toast (title) {
    Toast.show(title, {
      position: Toast.positions.CENTER
    })
  },
  async setAsyncStorage (key, value) {
    try {
      await AsyncStorage.setItem(key, value);
    } catch (e) {
      // saving error
    }
  },
  async getAsyncStorage (key) {
    try {
      const value = await AsyncStorage.getItem(key)
      return value;
    } catch (e) {
      return null;
      // error reading value
    }
  }
}